package com.bootlever.dubbo.consumer.server.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.bootlever.dubbo.provider.api.DubboDemoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestDubboController {

    private static final Logger logger = LoggerFactory.getLogger(TestDubboController.class);

    @Reference(version = "1.0.0")
    private DubboDemoService dubboDemoService;

    @RequestMapping(value = "/testdubbo/{id}")
    public String testDubbo(@PathVariable("id") String id){
        logger.info("调用....{}",id);
        return dubboDemoService.getUserName(id);
    }
}
